package com.study.a16Test;

public class MyThread extends Thread {


    static int a=1;
        @Override
        public void run() {
            while(true){
                if (method()) {

                    break;
                }
            }
        }

    private synchronized boolean method() {
            if(a==100){
                System.out.println();;
                return true;
            }else{
                a++;
                if(a%2!=0){
                    System.out.println(getName()+"奇数"+a);
                }

            }
            return false;
    }
}
